/**
 * 客户资料维护 - 编辑页面
 * @author miaoyl
 * @date 2018/01/14
 */
define(function () {

    var self,
        app = win.app,
        doc = document,
        layui = win.layui,
        current = 0,
        vueData = {
            isAdd: false,
            isDetail: false,
            is_rules: false,
            disabled:true,
            // dakehuDisabled: false,
            gwak088Show: false,
            imgs: g_ctxPath + 'crm/gwai500/imgs',
            files: g_ctxPath + 'upload/files',
            imgList: [],
            imgList2: [],
            file: '',
            fileList: [],
            fileList2: [],
            dialogImageUrl: '',
            address: '',
            dialogVisible: false,
            count: 0,
            count1: 0,
            activeNames:['first','second'],
            form: {
                GWAKPLANT_NAME: null,
                GWAKMLEGAL_NAME: null,
                GWAK010_NAME: null,
                GWAK009_NAME: null,
                GWAK008_NAME: null,
                GWAK058_NAME: null,
                GWAK012_NAME: null,
                GWAK011_NAME: null,
                GWAK060_NAME: null,
                GWAK015_NAME: null,
                GWAKORIG_NAME: null,
                GWAKORIU_NAME: null,
                GWAK054_NAME: null,
                GWAL010: 'ASIA',
                GWAL011: 'CN',
                MOBILE: null,
                GWAK050_OLD: null,
                GWAK053_OLD: null,
                GWAK031_OLD: null,
                GWAK030_OLD: null,
                GWAK084_NAME: null,
                GWAK082_NAME: null,
                GWAK087_LIST:[]
               /* GWAK023_NAME: null,
                GWAK024_NAME: null,
                GWAK025_NAME: null,
                GWAK026_NAME: null,
                GWAK027_NAME: null*/

            },
            rules1: {
                GWAKORIU_NAME: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKDATE: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKORIG_NAME: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKMLEGAL_NAME: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKPLANT: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK001: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                // GWAK002: [
                //     {required: true, message: '不可为空', trigger: 'blur'}
                // ],
                GWAKL003: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKL004: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK023: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK024: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK025: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK077: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK028: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK009: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK016: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK054: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK064: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK065: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK008: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK083: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK012:[
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK076: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK050: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK053: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK031: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK030: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK068: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK069: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK051: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK011: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK078: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK079: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK080: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK074: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK075: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK007: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ], GWAK032: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK058: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK060: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK015: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK061: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK062: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK063: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK006: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ]

            },
            rules2: {
                GWAKORIU_NAME: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKDATE: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKORIG_NAME: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKMLEGAL_NAME: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKPLANT: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK001: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                // GWAK002: [
                //     {required: true, message: '不可为空', trigger: 'blur'}
                // ],
                GWAKL003: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAKL004: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK023: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK024: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK025: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK077: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK028: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK009: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK016: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK054: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK064: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK065: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                GWAK008: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],
                /*GWAK066: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],*/
                GWAK083: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],
                GWAK076: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ], GWAK050: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK053: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK031: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK030: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK068: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK069: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK051: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK011: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK078: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK079: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK080: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ], GWAK074: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK012:[
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK075: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ], GWAK007: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ], GWAK032: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK058: [
                    {required: true, message: '不可为空', trigger: 'blur'}
                ],GWAK060: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK015: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK061: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK062: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK063: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ],GWAK006: [
                    {required: true, message: '不可为空', trigger: 'change'}
                ]
            },
            rules3: {
                GWAKORIU_NAME: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAKDATE: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAKORIG_NAME: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAKMLEGAL_NAME: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAKPLANT: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                /*GWAK001: [
                 {required: true, message: '不可为空', trigger: 'blur'}
                 ],*/
                // GWAK002: [
                //     {required: true, message: '不可为空', trigger: 'blur'}
                // ],
                GWAKL003: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAKL004: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK023: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK024: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK025: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK077: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK028: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK009: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK016: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK054: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK064: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK065: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK008: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK083: [
                    {required: false, message: '不可为空', trigger: 'change'}
                ],GWAK012:[
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],
                GWAK076: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK050: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK053: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK031: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK030: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK068: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK069: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK051: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK011: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK078: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK079: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK080: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK074: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ],GWAK075: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK007: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ], GWAK032: [
                    {required: false, message: '不可为空', trigger: 'blur'}
                ]

            },
            selectOptions: {
                sys_y_n: app.datas_('sys_y_n'),
                gwak002Options: app.datas_('crm_gwai300_gwak002'),
                gwak006Options: app.datas_('crm_gwai300_gwak006'),
                gwak057Options: app.datas_('crm_gwai300_gwak057'),
                gwak059Options: app.datas_('crm_gwai501_gwax011'),
                gwak061Options: app.datas_('crm_gwai501_gwax011'),
                gwak023Options: [],
                gwak024Options: [],
                gwak025Options: [],
                gwak026Options: [],
                gwak027Options: [],
                gwak009Options: app.datas_('crm_gwai300_gwak009'),
                gwak054Options: [],
                gwak065Options: app.datas_('crm_gwai300_gwak065'),
                gwak074Options: app.datas_('sys_n_y'),
                gwak073Options: app.datas_('crm_gwai300_gwak073'),
                gwak011Options: app.datas_('crm_gwai300_gwak011'),
                gwak083Options: app.datas_('crm_gwai300_gwak083'),
                gwak080Options: app.datas_('crm_gwai300_gwak080'),
                gwak032Options: app.datas_('crm_gwai300_gwak032')
            },
        },
        pageVue,
        callObj, layOpenIndex
    ;

    var Gwai300Edit = app.Module.extend({
        init: function () {
            self = this;
            self._super({
                _tag: 'gwai300_edit',
                _loadTplsFull: [{
                    dom: 'common_open_window', tpl: '/common/_open_window'
                },
                    {
                        dom: 'gwai500_img', tpl: 'gwai500_img'
                    }]
            }, win);
        },

        editData: function () {
            app.ajax({
                xurl: 'crm/gwai300/edit',
                xdata: vueData.form,
                loading: true,
                //okmsg: '客户信息修改成功',
                cb: function (result) {
                    if (result.ok) {
                        //同步更新缓存对应的值
                        //callObj.update(result.xdata);
                        if(result.data.data.code == 500){
                            app.showError("客户信息修改失败");
                            layui.layer.open({
                                type: 1,
                                shade: false,
                                title: false, //不显示标题
                                area:['600px','400px'],
                                content: "报错信息："+result.data.data.msg, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                                cancel: function(){
                                }
                            });
                        }else {
                            app.showSuccess("客户信息修改成功");
                            app.pageModule('gwai300').reloadTableCurr();
                            layer.close(layOpenIndex);
                        }
                    }
                }
            });
        },

        addData: function () {
            app.ajax({
                xurl: 'crm/gwai300/add',
                xdata: vueData.form,
                loading: true,
                //okmsg: '客户信息保存成功',
                cb: function (result) {
                    if (result.ok) {
                        if(result.data.data.code == 500){
                            app.showError("客户信息保存失败");
                            layui.layer.open({
                                type: 1,
                                shade: false,
                                title: false, //不显示标题
                                area:['600px','400px'],
                                content: "报错信息："+result.data.data.msg, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                                cancel: function(){
                                }
                            });
                        }else {
                            app.showSuccess("客户信息保存成功");
                            app.pageModule('gwai300').reloadTableCurr();
                            layer.close(layOpenIndex);
                        }
                    }
                }
            });
        },

        _call: function (obj) {
            pageVue.$refs['form'].resetFields();
            layOpenIndex = obj.layOpenIndex;
            vueData.fileList = [];
            vueData.imgList2 = [];
            vueData.imgList = [];
            vueData.fileList2 = [];
            vueData.img = '';
            vueData.address = '';
            vueData.count = 0;
            vueData.count1 = 0;
            vueData.activeNames = ['first','second'];
            if(obj.is_detail){
                vueData.isDetail = true;
            }else {
                vueData.isDetail = false;
            }
            if(obj.is_rules){
                vueData.is_rules = true;
            }else {
                vueData.is_rules = false;
            }
            /*if(obj.is_dakehu){
                vueData.dakehuDisabled = true;
            }else {
                vueData.dakehuDisabled = false;
            }*/
            if (obj.is_add) {
                vueData.isAdd = true;
                vueData.disabled = true;
                vueData.gwak088Show = false;
                app.ajax({
                    xurl: 'crm/gwai300/getAddData',
                    xdata: {},
                    cb: function (result) {
                        if (result.ok) {
                            app.extendUpLow({
                                target: vueData.form,
                                res: [result.data.data,
                                    {
                                        GWAK002: '1',
                                        GWAK057: '2',
                                        GWAKACTI: 'Y',
                                        GWAK056: 1,
                                        GWAK059: 'Y',
                                        GWAK061: 'N',
                                        GWAK062: 0,
                                        GWAK063: 0,
                                        /*GWAK008: 'CNY',*/
                                        GWAK083: '1',
                                        GWAK086: 'N',
                                        GWAK060: 'LC 30',
                                        GWAK020: 'ASIA',
                                        GWAK021: 'CN',
                                        GWAK012: 'C06'
                                    }
                                ],
                                reset: true
                            });
                        }
                    }
                });
                // app.log(obj);

            } else {
                vueData.isAdd = false;
                callObj = obj.obj;
                app.extendUpLow({
                    target: vueData.form,
                    res: callObj.data,
                    reset: true
                });
                if(callObj.data.GWAKACTI == 'F' /*&& (!vueData.dakehuDisabled)*/){
                    vueData.form.GWAK086 = 'Y';
                    vueData.form.GWAKACTI = 'Y';
                    vueData.gwak088Show = true;
                }else {
                    //vueData.form.GWAK086 = 'N';
                    if(obj.is_detail) {
                        vueData.gwak088Show = true;
                    }else {
                        vueData.gwak088Show = false;
                    }
                }
                vueData.form.GWAK050_OLD = callObj.data.GWAK050;
                vueData.form.GWAK053_OLD = callObj.data.GWAK053;
                vueData.form.GWAK031_OLD = callObj.data.GWAK031;
                vueData.form.GWAK030_OLD = callObj.data.GWAK030;
                if (callObj.data.GWAK081 != undefined) {
                    if (callObj.data.GWAK081.length > 0) {
                        vueData.img = callObj.data.GWAK081;
                        vueData.status = false;
                        var list = callObj.data.GWAK081.split(',');
                        for (var i = 0; i < list.length; i++) {
                            vueData.imgList.push({
                                name: list[i], url: '/wissun-smfile/' + list[i]
                            })
                            vueData.imgList2.push({GWAK081: list[i]});
                        }
                    }
                }
                if (callObj.data.GWAK087 != undefined && callObj.data.GWAK087 != "") {
                    if (callObj.data.GWAK087.length > 0) {
                        vueData.address = callObj.data.GWAK087;
                        var list = callObj.data.GWAK087.split(',');
                        for (var i = 0; i < list.length; i++) {
                            vueData.fileList.push({
                                name:  list[i], url: '/wissun-smfile/' + list[i]
                            });
                            vueData.fileList2.push({GWAK087: list[i]});
                        }
                    }
                }
                self.getAddress();
            }
            pageVue.$nextTick(function(){  //使用vue.$nextTick()方法可以dom数据更新后延迟执行
                pageVue.$refs['form'].clearValidate();
            });
        },

        getAddress:function () {
            vueData.selectOptions.gwak024Options = [];
            if(vueData.form.GWAK023 != null && vueData.form.GWAK023 != '') {
                app.ajax({
                    xurl: 'crm/gwai300/getGwadList',
                    xdata: {gwad001: '5', gwad003: vueData.form.GWAK023, type: '4'},
                    cb: function (result) {
                        vueData.selectOptions.gwak024Options.pushArray(result.data.data);
                    }
                });
            }
            vueData.selectOptions.gwak025Options = [];
            if(vueData.form.GWAK024 != null && vueData.form.GWAK024 != '') {
                app.ajax({
                    xurl: 'crm/gwai300/getGwadList',
                    xdata: {gwad001: '6', gwad003: vueData.form.GWAK024, type: '5'},
                    cb: function (result) {
                        vueData.selectOptions.gwak025Options.pushArray(result.data.data);
                    }
                });
            }
            vueData.selectOptions.gwak026Options = [];
            if(vueData.form.GWAK025 != null && vueData.form.GWAK025 != '') {
                app.ajax({
                    xurl: 'crm/gwai300/getGwadList',
                    xdata: {gwad001: '7', gwad003: vueData.form.GWAK025, type: '6'},
                    cb: function (result) {
                        vueData.selectOptions.gwak026Options.pushArray(result.data.data);
                    }
                });
            }
            vueData.selectOptions.gwak027Options = [];
            if(vueData.form.GWAK026 != null && vueData.form.GWAK026 != '') {
                app.ajax({
                    xurl: 'crm/gwai300/getGwadList',
                    xdata: {gwad001: '8', gwad003: vueData.form.GWAK026, type: '7'},
                    cb: function (result) {
                        vueData.selectOptions.gwak027Options.pushArray(result.data.data);
                    }
                });
            }
        },

        sureAddData:function () {
            if (vueData.isAdd) {
                var flag = true;
                if (pageVue.$refs.upload2.uploadFiles.length > 0) {
                    flag = false;
                    pageVue.$refs.upload2.submit();
                } else {
                    if (vueData.form.GWAK086 == 'Y') {
                        app.showWarning("变更文件必输！");
                        flag = false;
                        return;
                    }
                    if (pageVue.$refs.upload1.uploadFiles.length > 0) {
                        flag = false;
                        pageVue.$refs.upload1.submit();
                    } else {
                        if (vueData.is_rules) {
                            app.showWarning("营业执照必输！");
                            flag = false;
                            return;
                        }
                    }
                }
                if (flag) {
                    self.addData();
                }
            } else {
                var flag = true;
                vueData.form.GWAK081 = '';
                for (var i = 0; i < vueData.imgList2.length; i++) {
                    if (i == 0) {
                        vueData.form.GWAK081 = vueData.imgList2[i].GWAK081;
                    } else {
                        vueData.form.GWAK081 = vueData.form.GWAK081 + ',' + vueData.imgList2[i].GWAK081;
                    }
                }
                vueData.form.GWAK087 = '';
                for (var i = 0; i < vueData.fileList2.length; i++) {
                    if (i == 0) {
                        vueData.form.GWAK087 = vueData.fileList2[i].GWAK087;
                    } else {
                        vueData.form.GWAK087 = vueData.form.GWAK087 + ',' + vueData.fileList2[i].GWAK087;
                    }
                }
                vueData.fileList2.forEach(function (v) {
                    pageVue.$refs.upload2.uploadFiles.removeByMap({
                        name: v.GWAK087
                    });
                });
                if (vueData.form.GWAK086 == 'Y' && vueData.fileList2.length == 0 && pageVue.$refs.upload2.uploadFiles.length == 0) {
                    app.showWarning("变更文件必输！");
                    flag = false;
                    return;
                }
                // if (!vueData.dakehuDisabled) {
                    /*pageVue.$refs.upload2.uploadFiles.removeByMap({
                        name: vueData.address
                    });*/
                    vueData.imgList2.forEach(function (v) {
                        pageVue.$refs.upload1.uploadFiles.removeByMap({
                            name: v.GWAK081
                        });
                    });
                    if (pageVue.$refs.upload2.uploadFiles.length > 0) {
                        flag = false;
                        pageVue.$refs.upload2.submit();
                    } else {
                        if (pageVue.$refs.upload1.uploadFiles.length > 0) {
                            flag = false;
                            pageVue.$refs.upload1.submit();
                        } else /*if(!vueData.dakehuDisabled)*/{
                            if (vueData.form.GWAK081 == null || vueData.form.GWAK081 == '') {
                                if (vueData.is_rules) {
                                    app.showWarning("营业执照必输！");
                                    flag = false;
                                    return;
                                }
                            }
                        }
                    }
                // }
                if (flag) {
                    self.editData();
                }
            }
        },

        _ready: function () {
            vueData.form = app.fields_(['crm_gwai300'], vueData.form);
            pageVue = new Vue({
                el: '#gwai300_edit',
                data: vueData,
                methods: {
                    openCk: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method:'q_gwas001',
                                    columnList: [
                                        {label: '仓库编号', prop: 'GWAS001', width: '150'},
                                        {label: '说明', prop: 'GWASL003', width: '150'},
                                        {label: '助记码', prop: 'GWASL004', width: '150'}
                                    ]
                                },
                                cb: function (data) {
                                    vueData.form.GWAK058 = data.GWAS001;
                                    vueData.form.GWAK058_NAME = data.GWASL003;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择默认仓库',
                                area: ['600px', '465px']
                            }
                        });
                    },
                    openFrzz: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwde003',
                                    searchParam:{
                                        GWDE002 : "ERP账套"
                                    },
                                    columnList: [
                                        {label: '选项值', prop: 'GWDE003', width: '150'},
                                        {label: '选项名称', prop: 'GWDE004', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAKPLANT = data.GWDE003;
                                    //vueData.form.GWAKPLANT_NAME = data.GWDE004;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择ERP营运中心',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openLegal:function() {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'cq_sysorg_biz_1',
                                    columnList: [
                                        {label: 'ID', prop: 'ID', width: '150'},
                                        {label: '归属法人', prop: 'NAME', width: '150'},
                                        {label: '营运中心编号', prop: 'AZP01', width: '150'},
                                        {label: '营运中心名称', prop: 'AZP02', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAKMLEGAL = data.ID;
                                    vueData.form.GWAKMLEGAL_NAME = data.NAME;
                                    vueData.form.GWAKPLANT = data.AZP01;
                                    //vueData.form.GWAKPLANT_NAME = data.AZP02;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择归属法人',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openBz: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method:'q_gwac001',
                                    columnList: [
                                        {label: '币种编号', prop: 'GWAC001', width: '150'},
                                        {label: '说明', prop: 'GWACL003', width: '150'},
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK008 = data.GWAC001;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择币种信息',
                                area: ['600px', '465px']
                            }
                        });
                    },
                    openKhfl: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwaf001',
                                    columnList: [
                                        {label: '客户分类编号', prop: 'GWAF001', width: '150'},
                                        {label: '客户分类名称', prop: 'GWAFL003', width: '150'},
                                        {label: '助记码', prop: 'GWAFL004', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK009 = data.GWAF001;
                                    vueData.form.GWAK009_NAME = data.GWAFL003;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择客户分类信息',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openXsqd: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method:'q_gwae001',
                                    searchParam: {
                                        hasPermission: true
                                    },
                                    columnList: [
                                        {label: '客户渠道编号', prop: 'GWAE001', width: '150'},
                                        {label: '说明', prop: 'GWAEL003', width: '150'},
                                        {label: '助记码', prop: 'GWAEL004', width: '150'},
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK010 = data.GWAE001;
                                    vueData.form.GWAK010_NAME = data.GWAEL003;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择客户渠道',
                                area: ['600px', '465px']
                            }
                        });
                    },
                    openSz: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwea001',
                                    columnList: [
                                        {label: '税种编号', prop: 'GWEA001', width: '150'},
                                        {label: '税种名称', prop: 'GWEA002', width: '150'},
                                        {label: '税率', prop: 'GWEA006', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK012 = data.GWEA001;
                                    vueData.form.GWAK012_NAME = data.GWEA002;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择税种信息',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openKhdj: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwaq001',
                                    columnList: [
                                        {label: '客户等级编号', prop: 'GWAQ001', width: '150'},
                                        {label: '客户等级名称', prop: 'GWAQL003', width: '150'},
                                        {label: '助记码', prop: 'GWAQL004', width: '150'},
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK011 = data.GWAQ001;
                                    vueData.form.GWAK011_NAME = data.GWAQL003;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择客户等级',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openGwak060: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwde003',
                                    searchParam:{
                                        GWDE002 : "付款条件"
                                    },
                                    columnList: [
                                        {label: '选项值', prop: 'GWDE003', width: '150'},
                                        {label: '选项名称', prop: 'GWDE004', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK060 = data.GWDE003;
                                    vueData.form.GWAK060_NAME = data.GWDE004;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择付款条件',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openGwak015: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwde003',
                                    searchParam:{
                                        GWDE002 : "价格条件"
                                    },
                                    columnList: [
                                        {label: '选项值', prop: 'GWDE003', width: '150'},
                                        {label: '选项名称', prop: 'GWDE004', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK015 = data.GWDE003;
                                    vueData.form.GWAK015_NAME = data.GWDE004;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择价格条件',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openGwak084: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwak001',
                                    columnList: [
                                        {label: '客户编号', prop: 'GWAK001', width: '150'},
                                        {label: '客户简称', prop: 'GWAKL003', width: '150'},
                                        {label: '客户全称', prop: 'GWAKL004', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK084 = data.GWAK001;
                                    vueData.form.GWAK084_NAME = data.GWAKL004;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择上级公司',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openGwak082: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_nmab001',
                                    columnList: [
                                        {label: '银行编号', prop: 'NMAB001', width: '150'},
                                        {label: '银行简称', prop: 'NMABL003', width: '150'},
                                        {label: '银行全名', prop: 'NMABL004', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK082 = data.NMAB001;
                                    vueData.form.GWAK004 = data.NMABL004;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择银行编号',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openGwakoriu: function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_sysuser_id',
                                    columnList: [
                                        {label: 'ID', prop: 'ID', width: '150'},
                                        {label: '姓名', prop: 'NAME', width: '150'},
                                        {label: '所在组织', prop: 'ORG_NAME', width: '150'},
                                        {label: '联系方式', prop: 'MOBILE', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAKORIU_NAME = data.NAME;
                                    vueData.form.GWAKORIU = data.ID;
                                    vueData.form.GWAKORIG = data.ORG_ID;
                                    vueData.form.GWAKORIG_NAME = data.ORG_NAME;
                                    vueData.form.MOBILE = data.MOBILE;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择创建人',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    cancel: function () {
                        layer.close(layOpenIndex);
                    },
                    sure: function () {
                        this.$refs['form'].validate(function (valid) {
                            if (valid) {
                                /*if (((vueData.form.GWAK082 != null && vueData.form.GWAK082 != '') && (vueData.form.GWAK067 == null || vueData.form.GWAK067 == '')) ||
                                    ((vueData.form.GWAK082 == null || vueData.form.GWAK082 == '') && (vueData.form.GWAK067 != null && vueData.form.GWAK067 != ''))) {
                                    app.showWarning("银行账号与银行编号需同时维护！");
                                    return;
                                }*/
                                app.ajax({
                                    async: false,
                                    xurl: 'crm/gwai300/getCount',
                                    xdata: {
                                        GWAK001: vueData.form.GWAK001,
                                        GWAKL004: vueData.form.GWAKL004,
                                        GWAK007: vueData.form.GWAK007,
                                        TYPE: '2'
                                    },
                                    cb: function (result) {
                                        if (result.ok) {
                                            if (result.data.data.code == 300) {
                                                app.showWarning("该客户的单位税号已经存在于系统中,不可重复建立！");
                                                return;
                                            } else if (result.data.data.code == 400) {
                                                app.confirm({
                                                    msg: '该客户名称已存在,是否重复建立？',
                                                    ok: function () {
                                                        self.sureAddData();
                                                    }
                                                });
                                            } else {
                                                self.sureAddData();
                                            }
                                        }
                                    }
                                });
                            }
                        });
                    },
                    gwak010Change: function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak010Options.find(function (item) {
                            return item.GWAE001 === val
                        });
                        vueData.form.GWAEL003 = obj.GWAEL003;
                    },
                    gwak011Change: function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak011Options.find(function (item) {
                            return item.GWAQ001 === val
                        });
                        vueData.form.GWAQL003 = obj.GWAQL003;
                    },
                    gwak005Change: function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak005Options.find(function (item) {
                            return item.GWAR001 === val
                        });
                        vueData.form.GWARL003 = obj.GWARL003;
                    },
                    gwak054Change: function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak054Options.find(function (item) {
                            return item.GWAG001 === val
                        });
                        vueData.form.GWAGL003 = obj.GWAGL003;
                    },
                    changeGwak023:function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak023Options.find(function (item) {
                            return item.GWAD002 === val
                        });
                        /*vueData.form.GWAK023_NAME = obj.GWADL004;*/
                        vueData.form.GWAK022 = obj.GWAD003;
                        pageVue.form.GWAK024 = "";
                        pageVue.form.GWAK025 = "";
                        pageVue.form.GWAK026 = "";
                        pageVue.form.GWAK027 = "";
                        /*pageVue.form.GWAK028 = "";*/
                        vueData.selectOptions.gwak024Options = [];
                        app.ajax({
                            xurl: 'crm/gwai300/getGwadList',
                            xdata: {gwad001: '5', gwad003: vueData.form.GWAK023, type: '4'},
                            cb: function (result) {
                                vueData.selectOptions.gwak024Options.pushArray(result.data.data);
                            }
                        });
                    },
                    changeGwak024:function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak024Options.find(function (item) {
                            return item.GWAD002 === val
                        });
                        /*vueData.form.GWAK024_NAME = obj.GWADL004;*/
                        pageVue.form.GWAK025 = "";
                        pageVue.form.GWAK026 = "";
                        pageVue.form.GWAK027 = "";
                        /*pageVue.form.GWAK028 = "";*/
                        vueData.selectOptions.gwak025Options = [];
                        app.ajax({
                            xurl: 'crm/gwai300/getGwadList',
                            xdata: {gwad001: '6', gwad003: vueData.form.GWAK024, type: '5'},
                            cb: function (result) {
                                vueData.selectOptions.gwak025Options.pushArray(result.data.data);
                            }
                        });
                    },
                    changeGwak025:function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak025Options.find(function (item) {
                            return item.GWAD002 === val
                        });
                        /*vueData.form.GWAK025_NAME = obj.GWADL004;*/
                        pageVue.form.GWAK026 = "";
                        pageVue.form.GWAK027 = "";
                        /*pageVue.form.GWAK028 = "";*/
                        vueData.selectOptions.gwak026Options = [];
                        app.ajax({
                            xurl: 'crm/gwai300/getGwadList',
                            xdata: {gwad001: '7', gwad003: vueData.form.GWAK025, type: '6'},
                            cb: function (result) {
                                vueData.selectOptions.gwak026Options.pushArray(result.data.data);
                            }
                        });
                    },
                    changeGwak026:function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak026Options.find(function (item) {
                            return item.GWAD002 === val
                        });
                        /*vueData.form.GWAK026_NAME = obj.GWADL004;*/
                        pageVue.form.GWAK027 = "";
                        /*pageVue.form.GWAK028 = "";*/
                        vueData.selectOptions.gwak026Options = [];
                        app.ajax({
                            xurl: 'crm/gwai300/getGwadList',
                            xdata: {gwad001: '8', gwad003: vueData.form.GWAK026, type: '7'},
                            cb: function (result) {
                                vueData.selectOptions.gwak027Options.pushArray(result.data.data);
                            }
                        });
                    },
                    changeGwak027:function (val) {
                        var obj = {};
                        obj = vueData.selectOptions.gwak027Options.find(function (item) {
                            return item.GWAD002 === val
                        });
                        /*vueData.form.GWAK027_NAME = obj.GWADL004;*/
                        /*pageVue.form.GWAK028 = "";*/
                    },
                    openGwak008:function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwac001',
                                    columnList: [
                                        {label: '币种编号', prop: 'GWAC001', width: '150'},
                                        {label: '说明', prop: 'GWACL003', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK008 = data.GWAC001;
                                    vueData.form.GWAK008_NAME = data.GWACL003;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择币别',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    openGwak054:function () {
                        self._openTplFull({
                            tag: 'common_open_window',
                            tagData: {
                                config: {
                                    method: 'q_gwbw001',
                                    columnList: [
                                        {label: '行业编号', prop: 'GWBW001', width: '150'},
                                        {label: '说明', prop: 'GWBWL003', width: '150'}
                                    ],
                                },
                                cb: function (data) {
                                    vueData.form.GWAK054 = data.GWBW001;
                                    vueData.form.GWAK054_NAME = data.GWBWL003;
                                }
                            },
                            index: 0,
                            openOpts: {
                                title: '选择行业',
                                area: ['600px', '470px']
                            }
                        });
                    },
                    beforeUploadImg: function (file) {
                        const isJPG = (file.type === 'image/png' || file.type === 'image/jpeg'
                        || file.type === 'image/gif');
                        const isLt2M = file.size / 1024 / 1024 <= 10;
                        if (!isJPG) {
                            this.$message.error("上传图片只能是 JPG|PNG|GIF 格式!");
                        }
                        if (!isLt2M) {
                            this.$message.error("上传图片大小不能超过 10MB!");
                    }

                        return isJPG && isLt2M;
                    },
                    successUploadImg: function (response) {
                        if (response.code == 200) {
                            pageVue.$message.success('图片上传成功');
                            if (vueData.form.GWAK081 == '' || vueData.form.GWAK081 == null) {
                                vueData.form.GWAK081 = response.data[0].name;
                            } else {
                                vueData.form.GWAK081 = vueData.form.GWAK081 + ',' + response.data[0].name;
                            }
                            vueData.count++;
                            if (vueData.count == pageVue.$refs.upload1.uploadFiles.length) {
                                if (vueData.isAdd) {
                                    self.addData();
                                } else {
                                    self.editData();
                                }
                                pageVue.$refs.upload1.clearFiles();
                            }
                        }
                    },
                    beforeUploadFiles: function (file) {
                        const isJPG = (file.type === 'application/pdf'
                        || file.type === 'application/msword' || file.type === 'application/vnd.ms-excel'
                        || file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
                        || file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'
                        || file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
                        const isLt2M = file.size / 1024 / 1024 <= 10;
                        if (!isJPG) {
                            this.$message.error('文件格式不对');
                        }
                        if (!isLt2M) {
                            this.$message.error('文件大小不能超过 10MB');
                        }
                        return isJPG && isLt2M;
                    },
                    successUploadFiles: function (response) {
                        if (response.code == 200) {
                            pageVue.$message.success('文件上传成功');
                            //vueData.form.GWAK087 = response.data[0].name;
                            /*if (pageVue.$refs.upload1.uploadFiles.length > 0) {
                                pageVue.$refs.upload1.submit();
                            } else {
                                if (vueData.isAdd) {
                                    self.addData();
                                } else {
                                    self.editData();
                                }
                                pageVue.$refs.upload2.clearFiles();
                            }*/
                            if (vueData.form.GWAK087 == '' || vueData.form.GWAK087 == null) {
                                vueData.form.GWAK087 = response.data[0].name;
                            } else {
                                vueData.form.GWAK087= vueData.form.GWAK087 + ',' + response.data[0].name;
                            }
                            vueData.count1++;
                            if (vueData.count1 == pageVue.$refs.upload2.uploadFiles.length) {
                                if (pageVue.$refs.upload1.uploadFiles.length > 0) {
                                    pageVue.$refs.upload1.submit();
                                } else {
                                    if (vueData.isAdd) {
                                        self.addData();
                                    } else {
                                        self.editData();
                                    }
                                    pageVue.$refs.upload2.clearFiles();
                                }
                            }
                        }
                    },
                    handleJpgRemove: function (file, fileList) {
                        if (!vueData.isAdd) {
                            vueData.imgList2.removeByMap({
                                GWAK081: file.name
                            });
                            file = '';
                        }
                    },
                    handleFileRemove: function (file, fileList) {
                        if (!vueData.isAdd) {
                            vueData.fileList2.removeByMap({
                                GWAK087: file.name
                            });
                            file = '';
                        }
                        /*vueData.form.GWAK087 = "";
                        file = '';*/
                    },
                    handleImgPreview: function (file) {
                        vueData.dialogImageUrl = '/wissun-smfile/' + file.name;
                        vueData.dialogVisible = true;
                    },
                    handleFilePreview: function (file) {
                        window.open('/wissun-smfile/' + file.name);
                    },
                    handleExceed: function (files, fileList) {
                        this.$message.warning("当前只允许选择一个文件，如果需要选择新的文件，请先删除之前的文件!");
                    },
                    handleExceedImg: function (files, fileList) {
                        this.$message.warning("当前只允许选择一个图片，如果需要选择新的图片，请先删除之前的图片!");
                    },
                    bigShow: function (item) {
                        // layer.open({
                        //     type: 1,
                        //     title: false,
                        //     closeBtn: 0,
                        //     area: ['500px', '500px'],
                        //     skin: 'layui-layer-nobg', //没有背景色
                        //     shadeClose: true,
                        //     content: '<img src="' + item + '" style="max-width:100%;height:100%">'
                        // });
                        /*self._openTplFull({
                            tag: 'gwai500_img',
                            tagData: item,
                            index: 1,
                            openOpts: {
                                title: '图片预览',
                                area: ['500px', '500px']
                            }
                        });*/

                       /* var oldImg;

                        var fullCon = document.getElementById('imgFull');
                        fullCon.style.display = 'block';


                        var fullImg = document.getElementById('imgFull_box');
                        if(fullImg.childNodes.length === 1) {
                            oldImg = document.getElementById('fullImg');
                            fullImg.removeChild(oldImg)
                        }
                        var imgUrl = document.createElement('img');
                        imgUrl.src = item;
                        imgUrl.id = 'fullImg';
                        imgUrl.style.maxHeight = '500px';
                        imgUrl.style.margin = 'auto';
                        imgUrl.style.display = 'block';
                        fullImg.appendChild(imgUrl);*/
                        new Viewer(document.getElementById('GWAK081_IMGS'));
                    },
                   /* tranform1: function () { //左旋转
                        var img = document.getElementById('fullImg');
                        current = (current+90)%360;
                        img.style.transform = 'rotate('+current+'deg)';
                    },
                    tranform2: function () {//右旋转
                        var img = document.getElementById('fullImg');
                        current = (current-90)%360;
                        img.style.transform = 'rotate('+current+'deg)';
                    },
                    close: function () {
                        var fullCon = document.getElementById('imgFull');
                        fullCon.style.display = 'none';
                    },*/
                    changeGwakl004:function () {
                        if(vueData.form.GWAKL004 != '' && vueData.form.GWAKL004 != null) {
                            app.ajax({
                                xurl: 'crm/gwai300/getCount',
                                xdata: {
                                    GWAK001: vueData.form.GWAK001,
                                    GWAKL004: vueData.form.GWAKL004,
                                    TYPE: '1'
                                },
                                cb: function (result) {
                                    if (result.ok) {
                                        if (result.data.data.code == 400) {
                                            app.showWarning("客户名称已存在！");
                                            return;
                                        }
                                    }
                                }
                            });
                        }
                    },
                    handleChange:function () {
                        
                    }
                },
                created: function () {
                    self._setEleIsReady('gwai300_edit');
                },
                computed:{
                    rulesList:function () {
                        if(vueData.is_rules){
                            return vueData.rules2;
                        }/*else if(vueData.dakehuDisabled) {
                            return vueData.rules3;
                        }*/else {
                            return vueData.rules1;
                        }
                    }
                },
                watch: {
                    'form.GWAK058_NAME': function () {
                        if (vueData.form.GWAK058_NAME == '') {
                            vueData.form.GWAK058 = '';
                        }
                    },
                    'form.GWAK008_NAME': function () {
                        if (vueData.form.GWAK008_NAME == '') {
                            vueData.form.GWAK008 = '';
                        }
                    },
                    'form.GWAK009_NAME': function () {
                        if (vueData.form.GWAK009_NAME == '') {
                            vueData.form.GWAK009 = '';
                        }
                    },
                    'form.GWAK010_NAME': function () {
                        if (vueData.form.GWAK010_NAME == '') {
                            vueData.form.GWAK010 = '';
                        }
                    },
                    'form.GWAK011_NAME': function () {
                        if (vueData.form.GWAK011_NAME == '') {
                            vueData.form.GWAK011 = '';
                        }
                    },
                    'form.GWAK012_NAME': function () {
                        if (vueData.form.GWAK012_NAME == '') {
                            vueData.form.GWAK012 = '';
                        }
                    },
                    'form.GWAK060_NAME': function () {
                        if (vueData.form.GWAK060_NAME == '') {
                            vueData.form.GWAK060 = '';
                        }
                    },
                    'form.GWAK015_NAME': function () {
                        if (vueData.form.GWAK015_NAME == '') {
                            vueData.form.GWAK015 = '';
                        }
                    },
                    /*'form.GWAKPLANT_NAME': function () {
                        if (vueData.form.GWAKPLANT_NAME == '') {
                            vueData.form.GWAKPLANT = '';
                        }
                    },*/
                    /*'form.GWAK082': function () {
                        if (vueData.form.GWAK082 == '') {
                            vueData.form.GWAK004 = '';
                        }
                    },*/
                    'form.GWAK084_NAME': function () {
                        if (vueData.form.GWAK084_NAME == '') {
                            vueData.form.GWAK084 = '';
                        }
                    },
                    'form.GWAK061':function () {
                        if(vueData.form.GWAK061 == 'N'){
                            vueData.form.GWAK062 = '0';
                            vueData.disabled = true;
                        }else {
                            vueData.disabled = false;
                        }
                    },
                    /*'form.GWAK009': function () {
                        if (vueData.form.GWAK009 == '' || vueData.form.GWAK009 == null) {
                            vueData.form.GWAK006 = '';
                        }else if(vueData.form.GWAK009 == '4'){
                            vueData.form.GWAK006 = '2';
                        }else if(vueData.form.GWAK009 == '5'){
                            vueData.form.GWAK006 = '3';
                        }else {
                            vueData.form.GWAK006 = '1';
                        }
                    }*/
                }
            });
        },

        _lazy: function () {
            this._super();

            app.ajax({
                xurl: 'crm/gwai300/getGwadList',
                xdata: {gwad001: '4', type: '3'},
                cb: function (result) {
                    vueData.selectOptions.gwak023Options.pushArray(result.data.data);
                }
            });
        }
    });

    return new Gwai300Edit();

});